channel()
function channel() {



    $.ajax({
        url:root.dockingplatform.listCustomerInfo,
        cache: false,  //禁用缓存
        type: "POST",
        dataType:'json',
        contentType: "application/json",
        data: JSON.stringify({
            "pageNum":1,
            "pageSize":50,
            "customerId":$("#customerId").val(),
            "customerName":$("#customerName").val(),
            "customerCode":$("#customerCode").val(),
        }),
        success: function (data) {
            console.log(data)
            couponlist(data.data.result);
            $('.M-box3').pagination({
                pageCount: data.data.totalPage,
                jump: true,
                coping: true,
                prevContent: '上页',
                nextContent: '下页',
                callback: function (api) {
                    $.ajax({
                        /* root.member.adminMember2CList*/
                        url: root.dockingplatform.listCustomerInfo,
                        cache: false,  //禁用缓存
                        type: "POST",
                        dataType:'json',
                        contentType: "application/json",
                        data: JSON.stringify({
                            "pageNum":api.getCurrent(),
                            "pageSize":50,
                            "customerId":$("#customerId").val(),
                            "customerName":$("#customerName").val(),
                            "customerCode":$("#customerCode").val(),
                        }),
                        success: function (result) {
                            couponlist(result.data.result);
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            alert(XMLHttpRequest);
                        }
                    });
                }
            });

        },
        error: function () {
            $.Huimodalalert('失败！',2000);
        }
    });
}
var idsss=""

var dataSource = new Array();
//table的数据源
var table;   //table对象
dataSource = [];
function couponlist(data, index){
    console.log(data)
    sessionStorage.setItem("authorizedUsers", JSON.stringify(data));
    dataSource.splice(0,dataSource.length);//清空数组
        $.each(data, function (i, field) {
            var rowData = new Array();
            rowData.push(field.customerId);
            rowData.push(field.customerCode);
            rowData.push(field.customerName);
            rowData.push(field.belongGroupName);
            dataSource.push(rowData);

        });

    initDataTable(dataSource);

    function initDataTable(dataSource) {

        var dttable = $('#datatable').dataTable(); // 初始化dataTable，清空上一个值
        dttable.fnClearTable(); //清空一下table
        dttable.fnDestroy(); //还原初始化了的datatable
        $("#datatable").DataTable({
            "autoWidth": false,
            "ordering": false,
            "searching": false,
            "paging": false,
            "retrieve": true,
            "destroy": true,
            "bAutoWidth": true,
            "bLengthChange": true,
            "aLengthMenu": false,
            "oLanguage": {
                "sLengthMenu": "每页显示 _MENU_ 条记录",
                "sZeroRecords": "抱歉， 没有找到",
                "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                "sInfoEmpty": "没有数据",
                "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "前一页",
                    "sNext": "后一页",
                    "sLast": "尾页"
                },
                "sZeroRecords": "没有检索到数据",
            },
            data: dataSource,
            columnDefs: [
                {
                    "visible": true,
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = row[0]
                        if (val == undefined) {
                            val = ''
                        }
                        return val;
                    },
                    "targets": 0
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = row[1]
                        if (val == undefined) {
                            val = ''
                        }
                        return val;
                    },
                    "targets": 1
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = row[2]
                        if (val == undefined) {
                            val = ''
                        }
                        return val;
                    },
                    "targets": 2
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = row[3]
                        if (val == undefined) {
                            val = ''
                        }
                        return val;
                    },
                    "targets": 3
                },
                {
                    "render": function (data, type, row, meta) {
                        var val = '<a onclick="projectSetting(\'新增项目\',\'addProject.html\',\''+row[0]+'\',\''+row[1]+'\',\''+row[2]+'\',\''+row[3]+'\')">选择</a>'
                        return val;
                    },
                    "targets": 4
                },
            ]
        });
    }
}


function projectSetting(title,url,id,code,name,belongGroupName) {

    window.parent.customerId = id;
    window.parent.customerCode = code;
    window.parent.customerName = name;
    window.parent.belongGroupName = belongGroupName;
    window.parent.invioceInit1();
    parent.layer.closeAll();

    /*var index1 = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index1);*/

   /* var index = layer.open({
        type: 2,
        title: title,
        content: url
    });
    layer.full(index);
    var index1 = parent.location.reload();
    parent.layer.close(index1);*/


}


//跳转详情
function channelDetails(title,url,data){
    sessionStorage.setItem("id",data);
    var index = layer.open({
        type: 2,
        title: title,
        content: url
    });
    layer.full(index);
}
//价格设置
function channelDetails2(title,url,data,ids,name){
    sessionStorage.removeItem("click_a")
    sessionStorage.removeItem("click_b")
    sessionStorage.removeItem("zhekoulv")

    sessionStorage.setItem("customerName",name);
    sessionStorage.setItem("id",ids);
    sessionStorage.setItem("customerid",data);
    var index = layer.open({
        type: 2,
        title: title,
        content: url
    });
    layer.full(index);
}